<!--
 * @Author: wanlixin
 * @Date: 2019-10-04 18:23:49
 * @LastEditors: sylvanas
 * @LastEditTime: 2019-11-07 21:16:36
 * @Description: 
 -->
<template>
  <li class="grimm-timeline-item">
    <div class="grimm-timeline-item-line" :style="{background: $parent.color}"></div>
    <div class="grimm-timeline-item-content">
      <slot></slot>
    </div>
  </li>
</template>
<script>
export default {
  name: 'grimm-timeline-item',
};
</script>
<style lang="stylus" >
$circleWidth = 16px;

.grimm-timeline-item {
  display: flex;
}

.grimm-timeline-item-line {
  position: relative;
  top: 5px;
  width: 4px;
  height: auto;
}

.grimm-timeline-item:nth-child(1) .grimm-timeline-item-line::before {
  top: 0;
}

.grimm-timeline-item:nth-last-child(2) .grimm-timeline-item-line::after {
  bottom: -$circleWidth;
}

.grimm-timeline-item .grimm-timeline-item-line::before, .grimm-timeline-item:nth-last-child(2) .grimm-timeline-item-line::after {
  content: '';
  position: absolute;
  left: 50%;
  width: $circleWidth;
  height: $circleWidth;
  border-radius: 50%;
  background: inherit;
  transform: translate3d(-50%, 0, 0);
}

.grimm-timeline-item:nth-last-child(1) .grimm-timeline-item-line {
  display: none;
}

.grimm-timeline-item-content {
  padding: 0 0 20px 20px;
}
</style>